package nl.vu.few.ibivu.biomodels.shared;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Embedded;
import javax.persistence.Id;
import javax.persistence.PrePersist;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Indexed;
import com.googlecode.objectify.annotation.Unindexed;

@Unindexed
public class PetrifierModelExecution  implements Serializable {

	private static final long serialVersionUID = -8765793563350628134L;
	private @Embedded List<String> nodeIdList;
	private @Embedded List<Boolean> tsccList;
	private @Indexed Key<Model> model;
	private Date timestamp;
	private @Id Long id;
	
	private PetrifierModelExecution() {}
	
	public PetrifierModelExecution(Model model, List<String> labelList, List<Boolean> tsccList) {
		this();
		this.model = (model == null) ? null : new Key<Model>(Model.class, model.getId());
		this.nodeIdList = labelList;
		this.tsccList = tsccList;
	}
	
	@SuppressWarnings("unused")
	@PrePersist
	private void setTimestamp() {
		timestamp = new Date();
	}

	public List<String> getNodeIdList() {
		return nodeIdList;
	}

	public List<Boolean> getTsccList() {
		return tsccList;
	}

	public Key<Model> getModel() {
		return model;
	}
	
	public Long getId() {
		return id;
	}

	public Date getTimestamp() {
		return timestamp;
	}
}
